﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace AllenHung.FeedReader
{
    public partial class SettingsPage : PhoneApplicationPage
    {
        public SettingsPage()
        {
            InitializeComponent();
        }

        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);
            if (SpeechRecogToggle.IsChecked.HasValue)
            {
                App.SpeechOn = this.SpeechRecogToggle.IsChecked.Value;
            }
            if (AutoplayToggle.IsChecked.HasValue)
            {
                App.AutoplayNext = AutoplayToggle.IsChecked.Value;
            }
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            SpeechRecogToggle.IsChecked = App.SpeechOn;
            AutoplayToggle.IsChecked = App.AutoplayNext;
        }
    }
}